package com.example.test;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import com.example.test.util.ToastUtil;


public class DeleteActivity extends AppCompatActivity {
    private EditText carNumber;
    String CarNumber;
    private MySQLiteOpenHelper_1 mySQLiteOpenHelper_1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_delete);
        carNumber = findViewById(R.id.carNumber);
        mySQLiteOpenHelper_1 = new MySQLiteOpenHelper_1(this);
    }
    public void delete_btn(View view){
        CarNumber = carNumber.getText().toString().trim();
        int row =mySQLiteOpenHelper_1.deleteFromDbByCarNumber(CarNumber);
        if (row>0){
            ToastUtil.toastLong(this,"删除成功，删除了"+row+"条数据");
        }else {
            ToastUtil.toastLong(this,"删除失败，无此车牌号");
        }
    }
}